newseg			equ 	900h	;跳出MBR之后的新段地址
jmp newprogram



msgstep2:	db 'step2:now jump out mbr','$'
msgmem2:	db 'memory address is---','$'
msgcs2:		db 'CS:????H','$'

newprogram:
mov ax,newseg			;跳转到新地址900H后，全部寄存器启用新的段地址
mov ds,ax
mov es,ax
call outmbr
call showcsnew
jmp $


outmbr:
call 	newlinenew
call 	newlinenew
mov		si,msgstep2
call 	printstrnew
call 	newlinenew
mov 	si,msgmem2
call 	printstrnew
ret

showcsnew:
	mov ax,cs
	
	
	mov dl,ah
	call HL4BITnew
	mov dl, BH
	call ASCIInew
	mov [msgcs2+3],dl
	
	mov dl, Bl
	call ASCIInew
	mov [msgcs2+4],dl
	
	mov dl,al
	call HL4BITnew
	mov dl, BH
	call ASCIInew
	mov [msgcs2+5],dl
	
	mov dl, Bl
	call ASCIInew
	mov [msgcs2+6],dl
	
	mov si,msgcs2
	call printstrnew
	
	ret
	
printstrnew:	;显示指定的字符串，以"$"为结束标记
	mov al,[si]
	cmp al,'$'
	je disovernew
	mov ah,0eh
	int 10h
	inc si
	jmp printstrnew
disovernew:
	ret
	
newlinenew:	;显示回车换行
	mov ah,0eh
	mov al,0dh
	int 10h
	mov al,0ah
	int 10h
	ret
	
;-------------将16进制数字（4位）转换成ASCII码，输入DL，输出DL--
ASCIInew:	CMP DL,9
		JG LETTERnew	;DL>0AH
		ADD DL,30H	;如果是数字，加30H转换为ASCII码
		RET
LETTERnew:	ADD DL,37H	;如果是A-F，加37H转换成ASCII码
		RET
		
;------------取出一个字节的高四位和低四位，输入DL，输出BH和BL------
HL4BITnew:	MOV DH,dl
		MOV BL,dl
		SHR DH,1
		SHR DH,1
		SHR DH,1
		SHR DH,1
		MOV BH,DH
		AND BL,0FH
		RET
		
times 512-($-$$) db 0